<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonList.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript">
  var tractionId = null;
  var clazz = null;
  var statuz= null;
  var tranName = null;
  function reSetBalanceValue(balanceValue){
     parent.parent.reSetBalanceValue(balanceValue);
  }

  function reSetLateFeeValue(lateFeeValue){
   parent.parent.reSetLateFeeValue(lateFeeValue);
  }

  function reSetPrincipalValue(blanceValue,lateFeeValue){
	  parent.parent.reSetPrincipalValue(blanceValue,lateFeeValue);
  }

  function showDetail(id,clazz){
  	if(clazz == "005"){
	var url = "${ctx}/charge_cashieringAction.do?method=showDetail&tractionId="+id;
	//top.windowOpen(url, "multiPayDetail", "", 330, 600);
	common_submit("","noAskWindow",url,"",330,650);
	}
  }
  function showRightMenu(event)
  {
    //clazz :001本金交易;002减免交易;003调整交易;004滞纳金交易;005支付交易
    //statuz:001未缴;002已缴;003全额减免;004挂起;005出盘锁定
  	var tempFlat=parent.isShowButtom();
  	if(tempFlat=='true'){
  		if(clazz=="002" || clazz=="003" || clazz=="005"){
  		 return false;
  		}
  		else if(clazz=="001" || clazz=="004"){
  			if(statuz == "001"){
  			 if(document.getElementById("tr1")!=null)
  			    document.getElementById("tr1").style.display="";
  			 if(clazz=="004"){
	  			 if(document.getElementById("tr2")!=null)
	  			    document.getElementById("tr2").style.display="none";
  			 }else{
  			     if(document.getElementById("tr2")!=null)
	  			    document.getElementById("tr2").style.display="";
  			 }
  			 if(document.getElementById("tr3")!=null)
	  			document.getElementById("tr3").style.display="";
	  	    if(document.getElementById("tr4")!=null)
	  			document.getElementById("tr4").style.display="none";
  			}
  			else if(statuz=="004"){
  			 if(document.getElementById("tr1")!=null)
  				document.getElementById("tr1").style.display="none";
  			 if(document.getElementById("tr2")!=null)
  			    document.getElementById("tr2").style.display="none";
  			  if(document.getElementById("tr3")!=null)
  				document.getElementById("tr3").style.display="none";
  			 if(document.getElementById("tr4")!=null)
  				document.getElementById("tr4").style.display="";

  			}
  			else if(statuz=="005" || statuz=="003"){
  				return false;
  			}
  			else{
  			 if(document.getElementById("tr1")!=null)
  			    document.getElementById("tr1").style.display="";
  			  if(document.getElementById("tr2")!=null)
  			    document.getElementById("tr2").style.display="";
  			  if(document.getElementById("tr3")!=null)
  				document.getElementById("tr3").style.display="none";
  			 if(document.getElementById("tr4")!=null)
  				document.getElementById("tr4").style.display="none";
  			}
  		}
  		if(statuz=="002"){
  		  return false;
  		}
  		var div11=document.getElementById('quick_menu3');
  				var tempdiv=div11.getElementsByTagName("tr");
  				var count=0;
  				for(var ii=0;ii<div11.getElementsByTagName("tr").length;ii++){
  				  if(tempdiv[ii].style.display=='')count++;
                }
                tempdiv=null;
  				if(count==1){
  				div11.style.display="none";
  				return false;
  		}
  		ShowContextMenu(event,'quick_menu3');
  	}
  }
  function setTractionInfo(id,code,status,tran){
  	tractionId = id;
  	clazz = code;
  	statuz = status;
  	tranName = tran;
  }
  function openDerate(){
  	var url = "${ctx}/charge_cashieringAction.do?method=initDerateAdd&accountHouseId=${accountHouseId}&tractionId="+tractionId+"&statuz="+statuz;
  	common_submit("","noAskWindow", url, "${key.charge_chargeDetailList_derate}", 465, 450);
  }
  function openAdjust(){
  	var url = "${ctx}/charge_cashieringAction.do?method=initAdjustAdd&accountHouseId=${accountHouseId}&tractionId="+tractionId+"&statuz="+statuz;
  	common_submit("","noAskWindow", url, "${key.charge_chargeDetailList_adjust}", 465, 450);
  }
  function openSuspend(){
    if(tractionId == ""){
	   Alert('${key.tipsBySelect}');
	   return false;
	}
    AskConfirm("您确定要"+tranName+"挂起吗？","reCreateNote","${ctx}/charge_cashieringAction.do?method=addSuspend&tractionId="+tractionId+"&clazz="+clazz);
   }
   function openUnChainSuspend(){
    if(tractionId == ""){
	   Alert('${key.tipsBySelect}');
	   return false;
	}
    AskConfirm("您确定要"+tranName+"解除挂起吗？","reCreateNote","${ctx}/charge_cashieringAction.do?method=unChainSuspend&tractionId="+tractionId+"&clazz="+clazz);
   }
   function openReCalculate(){
   		var houseIds = parent.houseIds;
   		var houseNumbers = parent.houseNumbers;
   		var url = "${ctx}/charge_calculateAction.do?method=initRecalculation&houseId="+houseIds+"&houseNumber="+houseNumbers;
  		top.windowOpen(url, "payDetail", "${key.charge_chargeDetailList_recalculate}", 260, 450);
   }
   function resize(){
		parent.window.document.all('chargeDetailListFrame').style.height=document.body.scrollHeight;

	}
</script>
</head>
<body onload="resize();">
<div style="overflow:auto; height:250px;">
				<ec:tree
					identifier="transactionId"
					parentAttribute="parentId"
					items="chargeDetailList"
					action="${ctx}/charge_cashieringAction.do"
					view="pmsTree"
					filterable="false"
					sortable="true"
					showPagination="false"
					showStatusBar ="false"
					rowsDisplayed="10"
					var="item"
					styleClass="gridData2"
					>
				<ec:ceRow styleClass="grid" onclick="setTractionInfo('${item.transactionId}','${item.clazz}','${item.statuz}','${item.transName}')"  ondblclick="showDetail('${item.transactionId}','${item.clazz}')" onContextMenu="showRightMenu(event)" >
					<ec:ceColumn headerCell="pmsHeadrCell" title="${key.charge_chargeDetailList_transName}" property="transNameWithImage"    width="22%" cell="org.extremecomponents.tree.TreeCell" sortable="false"/>
					<ec:ceColumn headerCell="pmsHeadrCell" title="${key.charge_chargeDetailList_period}" property="period"   width="7%" sortable="true"/>
					<ec:ceColumn headerCell="pmsHeadrCell" title="${key.charge_chargeDetailList_price}" property="price"    width="12%" showTitle="false" sortable="true">
					    <c:if test="${item.clazz  eq '004' && item.showLateFeeLink eq true}">
							<a href="#" onclick="parent.showLateFeeDetail('${item.transactionId}');return false;" class='center_link_word'><fmt:formatNumber  value="${item.price}" pattern="###,###,###0.00"/></a>
						</c:if>
						<c:if test ="${item.clazz  != '004' || item.showLateFeeLink eq false}">
							<fmt:formatNumber  value="${item.price}" pattern="###,###,###0.00"/>
						</c:if>
					</ec:ceColumn>
					<ec:ceColumn headerCell="pmsHeadrCell" title="${key.charge_chargeDetailList_clazz}" property="statuzName"    width="6%" sortable="true"/>
					<ec:ceColumn headerCell="pmsHeadrCell" title="${key.charge_chargeDetailList_remark}" property="remark"   width="13%" sortable="true"/>
					<ec:ceColumn property="handTime" cell="date"  format="yyyy-MM-dd" title="${key.charge_chargeDetailList_handTime}"  headerCell="pmsHeadrCell"  width="9%" value="${item.handTime}" sortable="true"/>
					<ec:ceColumn property="firstPayDate" cell="date"  format="yyyy-MM-dd" title="${key.charge_chargeDetailList_firstPayDate}"  headerCell="pmsHeadrCell"  width="10%" value="${item.firstPayDate}" sortable="true"/>
					<ec:ceColumn property="lastPayDate" cell="date"  format="yyyy-MM-dd" title="${key.charge_chargeDetailList_lastPayDate}"  headerCell="pmsHeadrCell"  width="14%" value="${item.lastPayDate}" sortable="true"/>
					<ec:ceColumn headerCell="pmsHeadrCell" title="${key.charge_chargeDetailList_operator}" property="operatorName"   width="7%" sortable="false"/>
					<ec:parameter name = "transactionId" value="${item.transactionId}"></ec:parameter>
				</ec:ceRow>
				<ec:parameter name = "method" value="initChargeDetailList"></ec:parameter>
				<ec:parameter name = "periodId" value="${periodId== null ? '' :periodId}"></ec:parameter>
				<ec:parameter name = "periodStr" value="${periodStr== null ? '' :periodStr}"></ec:parameter>
				<ec:parameter name = "stat" value="${stat == null ? '':stat}"></ec:parameter>
				<ec:parameter name = "accountId" value="${accountId == null ? '':accountId}"></ec:parameter>
				<ec:parameter name = "accountHouseId" value="${accountHouseId == null ? '':accountHouseId}"></ec:parameter>
				</ec:tree>
				<c:if test="${leftTotal != null}">
	                   <script>
	                   reSetBalanceValue('${leftTotal}');
	                   reSetPrincipalValue(${leftTotal},${lateFeeTotal});
	                   </script>
                </c:if>
                <c:if test="${lateFeeTotal != null}">
	                   <script>
	                   reSetLateFeeValue('${lateFeeTotal}');
	                   </script>
                </c:if>
 </div>
 <div id="quick_rightmenu" style="display:none;"  oncontextmenu="return false" class="quick_rightmenu">
    <table width="100%" border="0" cellpadding="1" cellspacing="0" class="grid_quickMenu_bg">
      <tr >
        <td>
           <table width="100%" border="0" cellpadding="2" cellspacing="0">
           <pms:AuthTag authName="charge_cashieringAction.do?method=initDerateAdd">
			<tr>
              <td class="quickMenu_toolbarico"><a href="#"  onclick="" onfocus="this.blur()"><img src="${ctx}/images/ico_zxsf_sqth_jian.gif" border="0" align="absbottom" alt="${key.charge_chargeDetailList_derate}"/>&nbsp;${key.charge_chargeDetailList_derate}</a> </td>
            </tr>
            </pms:AuthTag>
            <pms:AuthTag authName="charge_calculateAction.do?method=initRecalculation">
            <tr>
              <td class="quickMenu_toolbarico"><a href="#"  onclick="" onfocus="this.blur()"><img src="${ctx}/images/chareg_ysjs_cs.gif" alt="重算"  border="0" align="absbottom" />&nbsp;重算</a></td>
            </tr>
            </pms:AuthTag>
            <tr>
                  <td class="hrpading">
                  <table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="quickMenu_line"></td>
                  </tr>
                  </table>
                  </td>
            </tr>
            <tr>
              <td class="quickMenu_toolbarico"><a href="javascript:;"  ><img src="${ctx}/images/ico_printer.gif" alt="打印" width="16" height="16" border="0" align="absbottom"/> 打印&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> </td>
           </tr>
        </table></td>
      </tr>
    </table>
  </div >
  <div id="quick_menu3" class="quick_menu2" style="display:none;">
    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="grid_quickMenu_bg"  onMouseOver="showmy2menu('quick_menu3')" onMouseOut="hidden2menu('quick_menu3')">
      <tr >
        <td>
            <table width="100%" border="0" cellpadding="2" cellspacing="0">
            <pms:AuthTag authName="charge_cashieringAction.do?method=initDerateAdd">
            <tr id="tr1" style="display:block">
              <td class="quickMenu_toolbarico"><a href="#"  onClick="openDerate();return false;" onFocus="this.blur()"><img src="${ctx}/images/ico_zxsf_sqth_jian.gif"  width="16" height="16" border="0" align="absbottom"/>&nbsp;${key.charge_chargeDetailList_derate}</a></td>
            </tr>
            </pms:AuthTag>
            <pms:AuthTag authName="charge_cashieringAction.do?method=initAdjustAdd">
			<tr id="tr2" style="display:block">
              <td class="quickMenu_toolbarico"><a href="#"  onClick="openAdjust();return false;" onFocus="this.blur()"><img src="${ctx}/images/charge_sjlr_tzds.gif" alt="${key.charge_chargeDetailList_adjust}" width="16" height="16" border="0" align="absbottom"/>&nbsp;${key.charge_chargeDetailList_adjust}</a> </td>
            </tr>
            </pms:AuthTag>
            <pms:AuthTag authName="charge_cashieringAction.do?method=addSuspend">
			 <tr id="tr3" style="display:block">
              <td class="quickMenu_toolbarico"><a href="#"  onClick="openSuspend();return false;" onFocus="this.blur()"><img src="${ctx}/images/charge_jcgq.gif" alt="${key.charge_chargeDetailList_suspend}" width="16" height="16" border="0" align="absbottom"/>&nbsp; ${key.charge_chargeDetailList_suspend}</a> </td>
            </tr>
            </pms:AuthTag>
            <pms:AuthTag authName="charge_cashieringAction.do?method=unChainSuspend">
            <tr id="tr4" style="display:block">
              <td class="quickMenu_toolbarico"><a href="#"  onClick="openUnChainSuspend();return false" onFocus="this.blur()"><img src="${ctx}/images/charge_guaqi.gif" alt="${key.charge_chargeDetailList_unchainsuspend}" width="16" height="16" border="0" align="absbottom"/>&nbsp; ${key.charge_chargeDetailList_unchainsuspend}</a> </td>
            </tr>
            </pms:AuthTag>
            <!--
            <pms:AuthTag authName="charge_calculateAction.do?method=initRecalculation">
            <tr id="tr5" style="display:block">
              <td class="quickMenu_toolbarico"><a href="#"  onclick="openReCalculate();return false;" onfocus="this.blur()"><img src="${ctx}/images/chareg_ysjs_cs.gif" alt="${key.charge_chargeDetailList_recalculate}"  border="0" align="absbottom" />&nbsp;${key.charge_chargeDetailList_recalculate}</a> </td>
            </tr>
            </pms:AuthTag>

            <tr>
              <td class="hrpading"><table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="quickMenu_line"></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td class="quickMenu_toolbarico"><a href="#" onclick="return false;" ><img src="${ctx}/images/ico_printer.gif" alt="${key.charge_chargeDetailList_print}" width="16" height="16" border="0" align="absbottom"/> &nbsp;${key.charge_chargeDetailList_print}</a> </td>
           </tr>
            -->
            </table>
         </td>
      </tr>
    </table>
    <script type="text/javascript">

	var div1=document.getElementById('quick_menu3');
	if(div1.getElementsByTagName("tr").length==1){
	div1.innerHTML="";
	}
</script>
  </div >
</body>
</html>